package net19;

import java.net.InetAddress;

public class InetAddressDemo02
{

	@SuppressWarnings("null")
	public static void main(String[] args) throws Exception
	{
		InetAddress locAdd = null;
		String host = "localhost";
		if(args.length ==1)
		{
			host = args[0];
		}
		
		locAdd = InetAddress.getByName(host);
		System.out.println("0.locAdd: "+locAdd);
		System.out.println("1.CanonicalHostName: "+locAdd.getCanonicalHostName());
		System.out.println("2.HostAddress: "+locAdd.getHostAddress());
		System.out.println("3.HostName: "+locAdd.getHostName());
		System.out.println("本机地址："+locAdd.getHostAddress());

	}

}
